package archer.back.models

import java.sql.Timestamp
import java.util.Date

import io.circe.{ Decoder, Encoder }
import io.circe.generic.auto._

import utils.CirceUtils

import scala.language.implicitConversions

case class DetailCrawlPlan(
  id: Int,
  name: String,
  parentNodeId: Int,
  modifiedTime: java.sql.Timestamp,
  sum: Int,
  failed: Int,
  success: Int,
  running: Int)

object DetailCrawlPlan extends CirceUtils {

  implicit val dateEncoder: Encoder[java.sql.Timestamp] =
    timestampEncoderFromPattern("yyyy-MM-dd HH:mm:ss.SSS")
  implicit val dateDecoder: Decoder[java.sql.Timestamp] =
    timestampDeocderFromPattern("yyyy-MM-dd HH:mm:ss.SSS")

  implicit val encoder = implicitly[Encoder[DetailCrawlPlan]]
  implicit val decoder = implicitly[Decoder[DetailCrawlPlan]]

}
